//== SAGITTARIUS ============================================================================

//== BEGINNING OF CODE ===============================================================

#ifndef __SAGUTTARUIS__LSYMBOLADAPTIVE__H_
#define __SAGUTTARUIS__LSYMBOLADAPTIVE__H_

//== INCLUDES ========================================================================

#include "sagittarius/core/SagittariusCore.h"
#include "sagittarius/unicode/CUnicode.h"

#ifdef __cplusplus
extern "C" {
#endif

///*** GMP ***///
//Enable for GMP:
#define LX_ALPHA_DO_PERVALUE

typedef LXAlphaAdaptive LXAlphaType;
//typedef LXAlphaType* LexBuf;
//typedef LXAlphaType* constLexBuf;

#define LX_ALPHA_SET(x, y)          sg_bignum_set(&(x).a, y)
#define LX_ALPHA_SET_SPC(x, y)      sg_bignum_set_ui(&(x).a, y)
#define LX_ALPHA_CLEAR(x)           mpz_clear((x).a)

//comparison
#define LX_CMPALPHA_EQ(x, y)     (SG_BIGNUM_CMP((x).a, y) == 0)
#define LX_CMPALPHA_EQ_SPC(x, y) (SG_BIGNUM_CMP_UI((x).a, y) == 0) //special: y is usually an unsigned long or something
#define LX_CMPALPHA_LT(x, y)     (SG_BIGNUM_CMP((x).a, y) < 0)
#define LX_CMPALPHA_LTE(x, y)    (SG_BIGNUM_CMP((x).a, y) <= 0)
#define LX_CMPALPHA_GT(x, y)     (SG_BIGNUM_CMP((x).a, y) > 0)
#define LX_CMPALPHA_GTE(x, y)    (SG_BIGNUM_CMP((x).a, y) >= 0)

//arithmetic
#define LX_ALPHA_INC(x) mpz_add_ui((x).a, (x).a, 1)
#define LX_ALPHA_DEC(x) mpz_sub_ui((x).a, (x).a, 1)
#define LX_ALPHA_ADD_SPC(r,x,y) mpz_add_ui((r).a,(x).a,y) //y is unsigned long

#ifdef __cplusplus
}//extern "C"
#endif

#endif
